package cn.fl.changeapply.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.user.facade.system.api.IPriorityApiService;
import cmm.user.facade.system.dto.SysResourceDTO;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.utils.*;
import cn.fl.capital.condition.CapPayeeInfoQueryCondition;
import cn.fl.capital.constant.CapPayInfoConstant;
import cn.fl.capital.constant.CapPayeeInfoConstant;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.capital.service.ICapPayInfoService;
import cn.fl.capital.service.ICapPayeeInfoService;
import cn.fl.capital.vo.CapPayInfoVO;
import cn.fl.capital.vo.CapPayeeInfoVO;
import cn.fl.changeapply.condition.PrjPrdChangeApplyQC;
import cn.fl.changeapply.constant.PrjPrdChangeApplyConstant;
import cn.fl.changeapply.service.IPrjPrdChangeApplyService;
import cn.fl.changeapply.vo.ChangeApplyVO;
import cn.fl.changeapply.vo.PrjPrdChangeApplyFlowVO;
import cn.fl.changeapply.vo.PrjPrdChangeApplyVO;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.project.condition.PrjPrdPaySchDQueryCondition;
import cn.fl.project.constant.PrjPrdDtlConstant;
import cn.fl.project.constant.PrjPrdPaySchMConstant;
import cn.fl.project.dto.PrjPrdPaySchDDTO;
import cn.fl.project.service.*;
import cn.fl.project.vo.*;
import cn.fl.ref.fribaseinfo.service.IFriBaseInfoService;
import cn.fl.ref.fribaseinfo.vo.FriBaseInfoVO;
import cn.fl.system.constant.SysLogConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.ref.fribaseinfo.condition.FriBaseInfoQueryCondition;
import fl.ref.fribaseinfo.constant.FriBaseInfoConstant;
import flow.business.facade.flow.api.IFlowBusinessQueryApiService;
import flow.business.facade.flow.condition.SysFlowSHQueryCondition;
import flow.business.facade.flow.dto.SysFlowSHDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import static java.time.temporal.ChronoUnit.DAYS;

/**
 * @Description: 项目产品变更记录表 控制层
 */
@Controller
@RequestMapping("/changeapply/prjPrdChangeApply")
public class PrjPrdChangeApplyController extends BaseController {

	@Autowired
	private IPrjPrdChangeApplyService prjPrdChangeApplyService;

	@Autowired
	private IFriBaseInfoService friBaseInfoService;

	@Autowired
	private IPrjBscInfoService prjBscInfoService;

	@Autowired
	private ICapPayInfoService capPayInfoService;

	@Autowired
	private ICapPayeeInfoService capPayeeInfoService;

	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;

	@Autowired
	private IPrjPrdLicInfoService prjPrdLicInfoService;

	@Autowired
	private IPrjPrdMtgService prjPrdMtgService;

	@Autowired
	private IPrjPrdPaySchMService prjPrdPaySchMService;

	@Autowired
	private IPriorityApiService priorityApiService;

	@Autowired
	private IPrjPaySchDApiService prjPaySchDApiService;

	@Autowired
	private IPrjPrdDtlService prjPrdDtlService;

	@Autowired
	private IFlowBusinessQueryApiService flowBusinessQueryApiService;

    /**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("changeapply/prjPrdChangeApply/prjPrdChangeApplyList");

		//项目类型
		List<KeyValueVO> prjTypCdList = prjPrdChangeApplyService.getKeyValueList(DictionaryConstant.CODE_PRJ_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		view.addObject("prjTypCdList", prjTypCdList);
		//所属机构
		List<KeyValueVO> orgList = prjPrdChangeApplyService.searchBusinessOrgList();
		view.addObject("orgList", orgList);
		//是否
		List<KeyValueVO> yesOrNoList = prjPrdChangeApplyService.getKeyValueList(DictionaryConstant.CODE_SYS_YES_NO_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		view.addObject("yesOrNoList", yesOrNoList);
		//第三方机构
		FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
		qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
		qc.setInsUseCd("2");
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		List<FriBaseInfoVO> friBaseInfoVOS = this.friBaseInfoService.searchList(qc);
		view.addObject("friBaseList", friBaseInfoVOS);
		//变更类型
		List<KeyValueVO> changeTypeList = prjPrdChangeApplyService.getKeyValueList(PrjPrdChangeApplyConstant.CHANGE_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		view.addObject("changeTypeList", changeTypeList);
		view.addObject("currentBuOrgCd", CurrentThreadContext.getCurrentBuOrgCd());
		view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());

		//仅客户经理有换车权限，展示换车按钮
		String isShowHC = "0";
		//功能角色权限
		List<SysResourceDTO> quitPrioList = this.priorityApiService.searchFuncWithAuth(CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentRoleId(), "huanche");
		if (CollectionUtils.isNotEmpty(quitPrioList)) {
			isShowHC = "1";
		}
		view.addObject("isShowHC",isShowHC);

		BaseLogUtils.newLogger("prjPrdChangeApplyList.view:{},操作人:{}", JSONObject.toJSONString(view), CurrentThreadContext.getCurrentUserName()).info();
		return view;
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		ModelAndView view = new ModelAndView("changeapply/prjPrdChangeApply/modify");
		view.addObject("id", id);
		BaseLogUtils.newLogger("toModifyPage跳转到修改页面.[id="+id+"]").info();
		return view;
	}

	/**
	 * 到退车/换车搜索页面
	 */
	@RequestMapping(value = "/toChangeApplyPage.do", method = { RequestMethod.GET })
	public ModelAndView toChangeApplyPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.newLogger("加载到退车/换车搜索页面.").info();
		String userId = request.getParameter("userId");
		String changeTypeCd = request.getParameter("changeTypeCd");
		ModelAndView view = new ModelAndView("changeapply/prjPrdChangeApply/changeApplyList");
		view.addObject("userId", userId);
		view.addObject("changeTypeCd", changeTypeCd);
		BaseLogUtils.newLogger("toChangeApplyPage跳转到变更车辆搜索页面.view:{}", JSONObject.toJSONString(view)).info();
		return view;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String lsCntNo = request.getParameter("lsCntNo");
		String cstNm = request.getParameter("cstNm");
		String buOrgCd = request.getParameter("buOrgCd");
		String prjTypCd = request.getParameter("prjTypCd");
		String isInsBiz = request.getParameter("isInsBiz");
		String isSplMfr = request.getParameter("isSplMfr");
		String insCode = request.getParameter("insCode");
		String changeTypeCd = request.getParameter("changeTypeCd");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjPrdChangeApplyQC qc = new PrjPrdChangeApplyQC();
		if (StringUtils.isNotEmpty(lsCntNo)) {
			qc.setLsCntNo(lsCntNo);
		}
		if (StringUtils.isNotEmpty(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotEmpty(buOrgCd)) {
			qc.setBuOrgCd(buOrgCd);
		}
		if (StringUtils.isNotEmpty(prjTypCd)) {
			qc.setPrjTypCd(prjTypCd);
		}
		if (StringUtils.isNotEmpty(isInsBiz)) {
			qc.setIsInsBiz(Integer.parseInt(isInsBiz));
		}
		if (StringUtils.isNotEmpty(isSplMfr)) {
			qc.setIsSplMfr(Integer.parseInt(isSplMfr));
		}
		if (StringUtils.isNotEmpty(insCode)) {
			qc.setInsCode(insCode);
		}
		if (StringUtils.isNotEmpty(changeTypeCd)) {
			qc.setChangeTypeCd(changeTypeCd);
		}
		qc.setCstMgrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		page.setCondition(qc);
		BaseLogUtils.newLogger("initList查询数据. request:" + JSONObject.toJSONString(page)).info();
		Pager pager = this.prjPrdChangeApplyService.searchListPage(page);
		List<PrjPrdChangeApplyVO> list = new ArrayList<>();
		if(pager != null && CollectionUtils.isNotEmpty(pager.getResultList())){
			list = (List<PrjPrdChangeApplyVO>) pager.getResultList();
		}
		ListPageVO<PrjPrdChangeApplyVO> listPage = new ListPageVO<PrjPrdChangeApplyVO>(list, pager.getTotalCount());
		BaseLogUtils.newLogger("initList查询数据完成. DATA:" + listPage.getTotal()).info();
		return listPage;
	}

	/**
	 * 初始化退车搜索列表
	 */
	@RequestMapping(value = "/initChangeList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initChangeList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String lsCntNo = request.getParameter("lsCntNo");
		String cstNm = request.getParameter("cstNm");
		String certNo = request.getParameter("certNo");
		String paySchNo = request.getParameter("paySchNo");
		//1-退车  2-换车
		String changeTypeCd = request.getParameter("changeTypeCd");
		if (StringUtils.isEmpty(changeTypeCd)){
			throw new BaseException("变更类型为空！");
		}
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjPrdChangeApplyQC qc = new PrjPrdChangeApplyQC();
		if (StringUtils.isNotEmpty(lsCntNo)) {
			qc.setLsCntNo(lsCntNo);
		}
		if (StringUtils.isNotEmpty(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotEmpty(certNo)) {
			qc.setCertNo(certNo);
		}
		if (StringUtils.isNotEmpty(paySchNo)) {
			qc.setPaySchNo(paySchNo);
		}
		qc.setChangeTypeCd(changeTypeCd);
		qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
		qc.setCstMgrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		page.setCondition(qc);
		BaseLogUtils.newLogger("initChangeList查询数据. request:" + JSONObject.toJSONString(page)).info();
		Pager pager = this.prjPrdChangeApplyService.searchChangeApplyListPage(page);
		List<ChangeApplyVO> list = new ArrayList<>();
		if(pager != null && CollectionUtils.isNotEmpty(pager.getResultList())){
			list = (List<ChangeApplyVO>) pager.getResultList();
		}
		ListPageVO<ChangeApplyVO> listPage = new ListPageVO<ChangeApplyVO>(list, pager.getTotalCount());
		BaseLogUtils.newLogger("initChangeList查询数据完成. DATA:" + listPage.getTotal()).info();
		return listPage;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeById.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		try {
			this.prjPrdChangeApplyService.removeById(Long.valueOf(id));
			BaseLogUtils.newLogger("removeById删除数据.[id="+id+"]").info();
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger( "removeById删除数据失败.[id="+id+"]"+ex.getMessage()).info();
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newLogger("removeById删除数据失败.[id="+id+"]"+ex.getMessage()).info();
		}

		return result;
	}

	/**
	 * 得到一条记录
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newLogger("getById获取数据,主键不存在.[id="+id+"]").info();
			return result;
		}
		
		try {
			PrjPrdChangeApplyVO vo = this.prjPrdChangeApplyService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.newLogger("getById", "获取数据,数据不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			}
			result.setData(vo);
			BaseLogUtils.newLogger("getById", "获取数据.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newLogger("getById获取失败.[id="+id+"]"+ex.getMessage()).error("",ex);
		}
		return result;
	}

	/**
	 * 到新增页面
	 */
	@RequestMapping(value = "/toAddPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.newLogger("toAddPage到退车申请页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView view = new ModelAndView("changeapply/prjPrdChangeApply/prjPrdChangeApplyAddPage");
        //变更类型：1-退车，2-换车，3-变更承租人
        String changeTypeCd = request.getParameter("changeTypeCd");
        //启用支付表ID
        String paySchId = request.getParameter("paySchId");
        try {
            view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
			//申请日期
			Date currentDate = new Date();
			view.addObject("currentDate", DateUtils.formatDateToString(currentDate, DateUtils.YYYY_MM_DD));
            //银行账户维护是否详情
            view.addObject("isDetail_bk", 0);
            if (StringUtils.isEmpty(paySchId)) {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "启用支付表ID为空.");
            }
            if (StringUtils.isEmpty(changeTypeCd)) {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "变更类型为空.");
            }
            view.addObject("changeTypeCd", changeTypeCd);
            view.addObject("paySchId", paySchId);
            //查询变更类型
			Map<String, String> changeTypeCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), PrjPrdChangeApplyConstant.CHANGE_TYPE_CD);
			if (changeTypeCdMap != null && changeTypeCdMap.containsKey(changeTypeCd)) {
				view.addObject("changeTypeCdNm", changeTypeCdMap.get(changeTypeCd));
			}
            //根据启用支付表ID查询支付表信息
			CapPayInfoVO capPayInfoVO = null;
			BaseLogUtils.newLogger("===退车申请查询付款信息Start===paySchId:" + paySchId).info();
			List<CapPayInfoVO> capPayInfoVOS = this.capPayInfoService.selectListByEnabledPaySchId(Long.valueOf(paySchId));
			BaseLogUtils.newLogger("===退车申请查询付款信息End===paySchId:{},list:{}", paySchId, JSON.toJSONString(capPayInfoVOS)).info();
			if (CollectionUtils.isNotEmpty(capPayInfoVOS)) {
				capPayInfoVO = capPayInfoVOS.get(0);
			}
			if (capPayInfoVO == null) {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "付款信息为空.");
            }

			view.addObject("capPayInfoVO", capPayInfoVO);

			//资金占用天数
			Long fundOccDays = 0l;
            //放款金额
			Long actPayAmt = 0l;
            //供应商返利
			Long rebateAmt = 0l;
            //销售返利
			Long saleActPayAmt = 0l;
            //查询支付表明细信息
            CapPayeeInfoQueryCondition qc = new CapPayeeInfoQueryCondition();
            qc.setPayId(capPayInfoVO.getId());
            List<String> purpCds = new ArrayList<>();
            purpCds.add(CapPayeeInfoConstant.CODE_PURP_CD_00000008_1);
            purpCds.add(CapPayeeInfoConstant.CODE_PURP_CD_00000008_11);
            purpCds.add(CapPayeeInfoConstant.CODE_PURP_CD_00000008_2);//供应商返利
            qc.setPurpCds(purpCds);
			BaseLogUtils.newLogger("===退车申请查询收款信息Start===payId:{},qc:{}", capPayInfoVO.getId(), JSON.toJSONString(qc)).info();
            List<CapPayeeInfoVO> capPayeeInfoVOS = this.capPayeeInfoService.searchList(qc);
			BaseLogUtils.newLogger("===退车申请查询收款信息End===payId:{},size:{}", capPayInfoVO.getId(), capPayeeInfoVOS == null ? 0 : capPayeeInfoVOS.size()).info();
            if (CollectionUtils.isNotEmpty(capPayeeInfoVOS)) {
                for (CapPayeeInfoVO vo : capPayeeInfoVOS) {
                    if (CapPayeeInfoConstant.CODE_PURP_CD_00000008_1.equals(vo.getPurpCd())) {
                        //实际放款时间
                        Date actPayTm = vo.getActPayTm();
						if (actPayTm != null) {
							view.addObject("actPayTm", DateUtils.formatDateToString(actPayTm, DateUtils.YYYY_MM_DD));
							LocalDate localDate = actPayTm.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
							fundOccDays = DAYS.between(localDate, LocalDate.now());
						}
						//放款金额
						if (vo.getActPayAmt() != null) {
							actPayAmt = vo.getActPayAmt();
						}
                    } else if (CapPayeeInfoConstant.CODE_PURP_CD_00000008_11.equals(vo.getPurpCd())) {
						//销售返利
						if (vo.getActPayAmt() != null) {
							saleActPayAmt = vo.getActPayAmt();
							view.addObject("saleActPayAmt", saleActPayAmt);
						}
                    } else if (CapPayeeInfoConstant.CODE_PURP_CD_00000008_2.equals(vo.getPurpCd())) {
						//供应商返利
						if (vo.getActPayAmt() != null) {
							rebateAmt = vo.getActPayAmt();
							view.addObject("rebateAmt", rebateAmt);
						}
					}
                }
            }
			if (fundOccDays < 0l) {
				fundOccDays = 0l;
			}
            view.addObject("fundOccDays", fundOccDays);

			//查询项目信息
			BaseLogUtils.newLogger("===退车申请查询项目信息Start===prjId:{}", capPayInfoVO.getPrjId()).info();
			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(capPayInfoVO.getPrjId());
			BaseLogUtils.newLogger("===退车申请查询项目信息End===prjId:{},vo:{}", capPayInfoVO.getPrjId(), JSON.toJSONString(prjBscInfoVO)).info();
            view.addObject("prjBscInfoVO", prjBscInfoVO);

            //查询启用支付表
			BaseLogUtils.newLogger("===退车申请查询支付表信息Start===paySchId:{}", paySchId).info();
			PrjPrdPaySchMVO prjPrdPaySchMVO = prjPrdPaySchMService.selectByIdWithoutDel(Long.valueOf(paySchId));
			BaseLogUtils.newLogger("===退车申请查询支付表信息End===paySchId:{},vo:{}", paySchId, JSON.toJSONString(prjPrdPaySchMVO)).info();
            if (prjPrdPaySchMVO == null) {
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "支付表信息为空.");
            }

            //起租日类型转换
            if (prjPrdPaySchMVO.getLsDt() != null) {
                prjPrdPaySchMVO.setLsDts(DateUtils.formatDateToString(prjPrdPaySchMVO.getLsDt(), DateUtils.YYYY_MM_DD));
            }

            //三方资管放款状态
            Map<String, String> thirdCapStsCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), CapitalConstant.CODE_THIRD_CAP_STS_CD);
            if (thirdCapStsCdMap != null) {
                prjPrdPaySchMVO.setPayerStsCdNm(thirdCapStsCdMap.get(prjPrdPaySchMVO.getPayerStsCd()));
            }

            //租赁年利率：取值为项目支付表中租赁年利率；若当前资产启用为赎回支付表，则取值我司支付表中租赁年利率
            if (PrjPrdPaySchMConstant.PAY_SCH_TYP_CD_SH.equals(prjPrdPaySchMVO.getPaySchTypCd())) {
                PrjPrdPaySchMVO prdPaySchMVO = prjPrdPaySchMService.selectByIdWithoutDel(capPayInfoVO.getPaySchId());
                if (prdPaySchMVO == null) {
                    throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "我司支付表信息为空.");
                }
                prjPrdPaySchMVO.setAnnIntRatePct(prdPaySchMVO.getAnnIntRatePct());
            }

            //应收款金额
			double recAmount = 0d;
            //资金占用成本=融资额*支付表年利率/360*资金占用天数，资管业务展示为空
            if (prjBscInfoVO.getIsInsBiz() != null && BaseConstant.IS_YESNO_NO == prjBscInfoVO.getIsInsBiz().intValue()) {
                double fundOccCost = 0d;
                if (prjPrdPaySchMVO.getAnnIntRatePct() != null && fundOccDays != 0) {
                    //若支付表对应租赁年利率低于6.15%*1.3,则资金占用成本=融资额*6.15%*1.3/360*资金占用天数
                    double annIntAmt;
					double rate = DecimalUtils.mul(6.15d, 1.3);
					if (prjPrdPaySchMVO.getAnnIntRatePct() < rate) {
						annIntAmt = DecimalUtils.mul(prjPrdPaySchMVO.getActLsAmt(), DecimalUtils.div(rate, 100));
					} else {
						annIntAmt = DecimalUtils.mul(prjPrdPaySchMVO.getActLsAmt(), DecimalUtils.div(prjPrdPaySchMVO.getAnnIntRatePct(), 100));
					}
                    //资金占用成本
					fundOccCost = DecimalUtils.mul(DecimalUtils.div(annIntAmt, 360), fundOccDays, 0);
                }
				BaseLogUtils.newLogger("===退车申请计算资金占用成本===paySchId:{},fundOccCost:{}", paySchId, String.valueOf(fundOccCost)).info();
				view.addObject("fundOccCost", new Double(fundOccCost).longValue());
                //应收款金额=放款金额+资金占用成本+供应商返利+销售返利---非资管业务
                recAmount = DecimalUtils.add(DecimalUtils.add(DecimalUtils.add(actPayAmt, fundOccCost), rebateAmt), saleActPayAmt);
            } else {
                //应收款金额=放款金额+供应商返利+销售返利----资管业务
                recAmount = DecimalUtils.add(DecimalUtils.add(actPayAmt, rebateAmt), saleActPayAmt);
            }
            view.addObject("recAmount", new Double(recAmount).longValue());
            view.addObject("actPayAmt", actPayAmt);

            //项目产品明细ID
            Long prjPrdDtlId = capPayInfoVO.getPrjPrdDtlId();
            //上牌状态
            String spStateNm = "未上牌";
            //抵押状态
            String dyStateNm = "未抵押";
            BaseLogUtils.newServiceLogger("===退车申请查询上牌抵押信息Start===prjPrdDtlId:" + prjPrdDtlId).info();
            if (StringUtils.isNotEmpty(prjPrdDtlId)) {
                //上牌状态
                PrjPrdLicInfoVO prjPrdLicInfoVO = this.prjPrdLicInfoService.selectById(prjPrdDtlId);
                BaseLogUtils.newServiceLogger("===退车申请查询上牌信息End===prjPrdDtlId:" + prjPrdDtlId + ",prjPrdLicInfoVO:" + JSON.toJSONString(prjPrdLicInfoVO)).info();
                if (null != prjPrdLicInfoVO && FlowConstant.FLOW_CHECK_STATE_PASS.equals(prjPrdLicInfoVO.getAudStsCd())) {
                    spStateNm = "已上牌";
                }
                //抵押状态
                PrjPrdMtgVO prjPrdMtgVO = this.prjPrdMtgService.selectById(prjPrdDtlId);
                BaseLogUtils.newServiceLogger("===退车申请查询抵押信息End===prjPrdDtlId:" + prjPrdDtlId + ",prjPrdMtgVO:" + JSON.toJSONString(prjPrdMtgVO)).info();
                if (null != prjPrdMtgVO && StringUtils.isNotEmpty(prjPrdMtgVO.getGuarStsCd())) {
                    Map<String, String> guarStsMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_GUAR_STS_CD);//抵押状态
					if (guarStsMap != null && guarStsMap.containsKey(prjPrdMtgVO.getGuarStsCd())) {
						dyStateNm = guarStsMap.get(prjPrdMtgVO.getGuarStsCd());
					}
                }
            }
            view.addObject("spStateNm", spStateNm);
            view.addObject("dyStateNm", dyStateNm);
            view.addObject("prjPrdPaySchMVO", prjPrdPaySchMVO);
        } catch (NumberFormatException e) {
            BaseLogUtils.newLogger("===toAddPage跳转退车申请页面BASE异常===Detail:" + e).setBussinessId(paySchId).setThrowable(e).error(LogExceptionEnum.COMMON_CODE_0002);
            e.printStackTrace();
        } catch (Exception e) {
            BaseLogUtils.newLogger("===toAddPage跳转退车申请页面BASE异常===Detail:" + e).setBussinessId(paySchId).setThrowable(e).error(LogExceptionEnum.COMMON_CODE_0002);
            e.printStackTrace();
        }
        BaseLogUtils.newLogger("toAddPage退车申请页面.返回前台.view:" + JSON.toJSONString(view)).info();
        return view;
    }

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String name = request.getParameter("name");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjPrdChangeApplyVO entity = null;
		try {
			entity = new PrjPrdChangeApplyVO();
			//TODO ADD PARAM
			Long id = this.prjPrdChangeApplyService.add(entity);
			result.setData(id);
			BaseLogUtils.newLogger("add", "新增数据.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newLogger("add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName()).error("",ex);
		}

		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String fundOccCosts = request.getParameter("fundOccCosts");
		String recAmounts = request.getParameter("recAmounts");
		String remark = request.getParameter("remark");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.newLogger("modify.修改退车审批记录失败.主键不存在." + CurrentThreadContext.getCurrentUserName()).info();
			return result;
		}

		PrjPrdChangeApplyVO entity = null;
		try {
			entity = new PrjPrdChangeApplyVO();
			entity.setId(Long.valueOf(id));
			if (StringUtils.isNotEmpty(fundOccCosts)) {
				if (!StringUtils.isUnsignedNumeric(fundOccCosts)) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "资金占用成本应为数字!");
				}
				entity.setFundOccCost(DecimalUtils.convertYuanToFen(Double.parseDouble(fundOccCosts.trim().replace(",", ""))));
			}
			if (StringUtils.isNotEmpty(recAmounts)) {
				if (!StringUtils.isUnsignedNumeric(recAmounts)) {
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "应收款金额应为数字!");
				}
				entity.setRecAmount(DecimalUtils.convertYuanToFen(Double.parseDouble(recAmounts.trim().replace(",", ""))));
			}
			if (StringUtils.isNotEmpty(remark)) {
				entity.setRemark(remark);
			}
			BaseLogUtils.newLogger("modify.修改退车审批记录Start.id:{},entity:{},userNm:{}", id, JSON.toJSONString(entity), CurrentThreadContext.getCurrentUserName()).info();
			boolean success = this.prjPrdChangeApplyService.modify(entity);
			BaseLogUtils.newLogger("modify.修改退车审批记录End.id:{},success:{},userNm:{}", id, success, CurrentThreadContext.getCurrentUserName()).info();
			if (!success) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
				BaseLogUtils.newLogger("modify.修改退车审批记录失败.id:{},entity:{},userNm:{}", id, JSON.toJSONString(entity), CurrentThreadContext.getCurrentUserName()).info();
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("modify.修改退车审批记录失败.id:{},entity:{},ex:{},userNm:{}", id, JSON.toJSONString(entity), ex.getMessage(), CurrentThreadContext.getCurrentUserName()).info();
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newLogger("modify.修改退车审批记录失败.id:{},entity:{},userNm:{}", id, JSON.toJSONString(entity), CurrentThreadContext.getCurrentUserName()).setThrowable(new Exception(ex)).error(LogExceptionEnum.API_CODE_0102);
		}
		return result;
	}

	/**
	 *  校验是否符合退车逻辑
	 *  	退车：不符合：1.资管多台车  2.已到第一期还款日
	 *      换车：
	 */
	@RequestMapping(value = "/changeCheck.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object changeCheck(HttpServletRequest request, HttpServletResponse response) {
		DataResultVO dataResultVO = new DataResultVO(BaseConstant.IS_YESNO_YES, "即将转到退车申请页面!");
		String prjId = request.getParameter("prjId");
		String paySchId = request.getParameter("paySchId");
		String changeTypeCd = request.getParameter("changeTypeCd");
		if (StringUtils.isEmpty(changeTypeCd)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "变更类型为空!");
		}
		BaseLogUtils.newLogger("changeCheck.校验是否符合退车逻辑==prjId:{},paySchId:{}",prjId,paySchId).info();
		try {
			this.prjPrdChangeApplyService.changeCheck(Long.valueOf(prjId),Long.valueOf(paySchId),changeTypeCd);
		} catch (BaseException e) {
			return new DataResultVO(BaseConstant.IS_YESNO_NO, e.getMessage());
		} catch (NumberFormatException e) {
			return new DataResultVO(BaseConstant.IS_YESNO_NO, e.getMessage());
		}
		return dataResultVO;
	}

	/**
	 * 到换车申请页面
	 */
	@RequestMapping(value = "/toAddPageForHC.do", method = {RequestMethod.GET})
	public ModelAndView toAddPageForHC(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.newLogger("toAddPageForHC.Start.UserNm:{}", CurrentThreadContext.getCurrentUserName());
		ModelAndView view = new ModelAndView("changeapply/prjPrdChangeApply/PrjPrdChangeAddHC");
		//变更类型：1-退车，2-退车，3-变更承租人
		String changeTypeCd = request.getParameter("changeTypeCd");
		//启用支付表ID
		String paySchId = request.getParameter("paySchId");
		try {
			view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
			if (StringUtils.isEmpty(paySchId)) {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "启用支付表ID为空.");
			}
			if (StringUtils.isEmpty(changeTypeCd)) {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "变更类型为空.");
			}
			view.addObject("changeTypeCd", changeTypeCd);
			view.addObject("paySchId", paySchId);

			//查询启用支付表
			BaseLogUtils.newLogger("===换车申请查询支付表信息Start===paySchId:{}", paySchId).info();
			PrjPrdPaySchMVO prjPrdPaySchMVO = this.prjPrdPaySchMService.selectByIdWithoutDel(Long.valueOf(paySchId));
			BaseLogUtils.newLogger("===换车申请查询支付表信息End===paySchId:{},vo:{}", paySchId, JSON.toJSONString(prjPrdPaySchMVO)).info();
			view.addObject("prjPrdPaySchMVO", prjPrdPaySchMVO);

			//查询已还期次
			Integer payPd = 0;
			PrjPrdPaySchDQueryCondition dQC = new PrjPrdPaySchDQueryCondition();
			List<Long> paySchIds = new ArrayList<>();
			paySchIds.add(Long.valueOf(paySchId));
			dQC.setPaySchIdList(paySchIds);
			List<PrjPrdPaySchDDTO> paidPayPdList = this.prjPaySchDApiService.searchPaidPayPdList(dQC);
			BaseLogUtils.newLogger("查询支付表信息：paySchId:{},paidPayPdList:{}", JSONObject.toJSONString(paySchIds), JSONObject.toJSONString(paidPayPdList)).info();
			if (CollectionUtils.isNotEmpty(paidPayPdList)) {
				payPd = paidPayPdList.get(0).getPayPd();
			}
			view.addObject("payPd", payPd);

			//根据启用支付表ID查询付款信息
			CapPayInfoVO capPayInfoVO = null;
			BaseLogUtils.newLogger("===退车申请查询付款信息Start===paySchId:" + paySchId).info();
			List<CapPayInfoVO> capPayInfoVOS = this.capPayInfoService.selectListByEnabledPaySchId(Long.valueOf(paySchId));
			BaseLogUtils.newLogger("===退车申请查询付款信息End===paySchId:{},list:{}", paySchId, JSON.toJSONString(capPayInfoVOS)).info();
			if (CollectionUtils.isNotEmpty(capPayInfoVOS)) {
				capPayInfoVO = capPayInfoVOS.get(0);
			}
			if (capPayInfoVO != null) {
				//查询支付表明细信息
				CapPayeeInfoQueryCondition qc = new CapPayeeInfoQueryCondition();
				qc.setPayId(capPayInfoVO.getId());
				List<String> purpCds = new ArrayList<>();
				purpCds.add(CapPayeeInfoConstant.CODE_PURP_CD_00000008_1);
				qc.setPurpCds(purpCds);
				BaseLogUtils.newLogger("===换车申请查询收款信息Start===payId:{},qc:{}", capPayInfoVO.getId(), JSON.toJSONString(qc)).info();
				List<CapPayeeInfoVO> capPayeeInfoVOS = this.capPayeeInfoService.searchList(qc);
				BaseLogUtils.newLogger("===换车申请查询收款信息End===payId:{},size:{}", capPayInfoVO.getId(), capPayeeInfoVOS == null ? 0 : capPayeeInfoVOS.size()).info();
				if (CollectionUtils.isNotEmpty(capPayeeInfoVOS)) {
					CapPayeeInfoVO capPayeeInfoVO = capPayeeInfoVOS.get(0);
					view.addObject("capPayeeInfoVO", capPayeeInfoVO);
				}
				//支付表状态
				PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectById(capPayInfoVO.getPrjPrdDtlId());
				if (prjPrdDtlVO != null && StringUtils.isNotEmpty(prjPrdDtlVO.getPrdStsCd())) {
					Map<String, String> prjPrdStsCdMap = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), PrjPrdDtlConstant.CODE_PRJ_PRD_STS_CD);
					view.addObject("prjPrdStsCd", prjPrdStsCdMap.get(prjPrdDtlVO.getPrdStsCd()));
				}
				//旧dtlId
				view.addObject("prjPrdDtlId", capPayInfoVO.getPrjPrdDtlId());
			}
			view.addObject("capPayInfoVO", capPayInfoVO);
			//查询新资产信息
			PrjPrdChangeApplyQC changeApplyQC = new PrjPrdChangeApplyQC();
			changeApplyQC.setPaySchId(Long.valueOf(paySchId));
			changeApplyQC.setChangeTypeCd(changeTypeCd);
			changeApplyQC.setIsDel(0);
			changeApplyQC.setIsHistory(0);
			List<PrjPrdChangeApplyVO> prjPrdChangeApplyVOS = this.prjPrdChangeApplyService.selectList(changeApplyQC);
			if (CollectionUtils.isNotEmpty(prjPrdChangeApplyVOS)) {
				PrjPrdChangeApplyVO prjPrdChangeApplyVO = prjPrdChangeApplyVOS.get(0);
				//查询是否是流程审批通过/不通过的记录，是，则新增，否则，直接用
				SysFlowSHQueryCondition sysFlowSHQC = new SysFlowSHQueryCondition();
				sysFlowSHQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
				sysFlowSHQC.setWordsInTheTable(CapPayInfoConstant.CAP_FLOW_S_H_CAP);
				sysFlowSHQC.setDataId(prjPrdChangeApplyVO.getId());
				sysFlowSHQC.setStatus(BaseConstant.IS_YESNO_YES);
				sysFlowSHQC.setBusTyp(PrjPrdChangeApplyConstant.CODE_CHANGE_APPLY_FLOW_HC);
				BaseLogUtils.newLogger("换车申请页面,查询换车审批流程记录信息Start,id:{},sysFlowSHQC:{}", prjPrdChangeApplyVO.getId(), JSON.toJSONString(sysFlowSHQC)).info();
				List<SysFlowSHDTO> sysFlowSHDTOS = this.flowBusinessQueryApiService.searchFlowSHDTOList(sysFlowSHQC);
				BaseLogUtils.newLogger("换车申请页面,查询换车审批流程记录信息End,id:{},sysFlowSHDTOS:{}", prjPrdChangeApplyVO.getId(), JSON.toJSONString(sysFlowSHDTOS)).info();
				boolean isExistFlowFlag = false;
				if (CollectionUtils.isNotEmpty(sysFlowSHDTOS)) {
					SysFlowSHDTO sysFlowSHDTO = sysFlowSHDTOS.get(0);
					if (FlowConstant.FLOW_CHECK_STATE_NO_PASS.equals(sysFlowSHDTO.getAudStsCd())
							|| FlowConstant.FLOW_CHECK_STATE_PASS.equals(sysFlowSHDTO.getAudStsCd())) {
						isExistFlowFlag = true;
					}
				}
				BaseLogUtils.newLogger("换车申请页面,查询换车审批流程记录信息,id:{},isExistFlowFlag:{}", prjPrdChangeApplyVO.getId(), isExistFlowFlag).info();
				if (!isExistFlowFlag) {
					Long newPrjPrdDtlId = prjPrdChangeApplyVO.getNewPrjPrdDtlId();
					if (newPrjPrdDtlId != null) {
						PrjPrdChangeApplyQC prjPrdChangeApplyQC = new PrjPrdChangeApplyQC();
						prjPrdChangeApplyQC.setPrjPrdDtlId(newPrjPrdDtlId);
						PrjPrdChangeApplyFlowVO newDtlVO = this.prjPrdChangeApplyService.getPrdChangeDetail(prjPrdChangeApplyQC, false);
						BaseLogUtils.newLogger("===换车申请页面详细信息===newPrjPrdDtlId:{},newDtlVO:{}", newPrjPrdDtlId, JSON.toJSONString(newDtlVO)).info();
						view.addObject("newDtlVO", newDtlVO);
					}
					view.addObject("changeApplyId", prjPrdChangeApplyVO.getId());
					view.addObject("newPrjPrdDtlId", newPrjPrdDtlId);
				}
			}
			view.addObject("detailFlag", false);
			view.addObject("flowFlag", false);
		} catch (NumberFormatException e) {
			BaseLogUtils.newLogger("===toAddPageForHC跳转换车申请页面BASE异常===Detail:" + e).setBussinessId(paySchId).setThrowable(e).error(LogExceptionEnum.COMMON_CODE_0002);
			e.printStackTrace();
		} catch (Exception e) {
			BaseLogUtils.newLogger("===toAddPageForHC跳转换车申请页面BASE异常===Detail:" + e).setBussinessId(paySchId).setThrowable(e).error(LogExceptionEnum.COMMON_CODE_0002);
			e.printStackTrace();
		}
		BaseLogUtils.newLogger("toAddPageForHC.view:{},操作人:{}", JSONObject.toJSONString(view), CurrentThreadContext.getCurrentUserName()).info();
		return view;
	}

	/**
	 * 换车申请页面获取详细信息
	 */
	@RequestMapping(value = "/getPrdChangeDetail.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getPrdChangeDetail(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String dtlId = request.getParameter("dtlId");
		String paySchId = request.getParameter("paySchId");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if (StringUtils.isEmpty(dtlId)) {
			BaseLogUtils.newLogger("getShowDetailById.换车申请页面获取详细信息参数不存在!" + CurrentThreadContext.getCurrentUserName()).info();
			return result;
		}
		try {
			PrjPrdChangeApplyQC qc = new PrjPrdChangeApplyQC();
			qc.setPrjPrdDtlId(Long.valueOf(dtlId));
			if (StringUtils.isNotEmpty(paySchId)) {
				qc.setPaySchId(Long.valueOf(paySchId));
			}
			PrjPrdChangeApplyFlowVO vo = this.prjPrdChangeApplyService.getPrdChangeDetail(qc, true);
			if (null == vo) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.newLogger("getShowDetailById.换车申请页面获取详细信息获取数据不存在!dtlId:{},userNm:{}", dtlId, CurrentThreadContext.getCurrentUserName()).info();
			}
			result.setData(vo);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.newLogger("getShowDetailById.换车申请页面获取详细信息获取数据失败!dtlId:{},userNm:{}", dtlId, CurrentThreadContext.getCurrentUserName()).info();
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.newLogger("getShowDetailById.换车申请页面获取详细信息获取数据失败.dtlId:{},userNm:{}", dtlId, CurrentThreadContext.getCurrentUserName()).setThrowable(new Exception(ex)).error(LogExceptionEnum.API_CODE_0102);
		}
		return result;
	}
}

